package com.tiny.work.plane;

import java.math.BigDecimal;

public class Context {

    private IModel model;

    private BigDecimal journey;

    private Pilot pilot;

    private ArrangePilot arrangePilot;

    public IModel getModel() {
        return model;
    }

    public Context setModel(IModel model) {
        this.model = model;
        return this;
    }

    public BigDecimal getJourney() {
        return journey;
    }

    public Context setJourney(BigDecimal journey) {
        this.journey = journey;
        return this;
    }

    public Pilot getPilot() {
        return pilot;
    }

    public Context setPilot(Pilot pilot) {
        this.pilot = pilot;
        return this;
    }

    public Context(BigDecimal journey) {
        this.journey = journey;
    }

    public Context(BigDecimal journey, Pilot pilot) {
        this.journey = journey;
        this.pilot = pilot;
    }

    public Context() {
    }

    public PlaneResult getResult(BigDecimal journey, BigDecimal weight) {
        return model.algorithm(journey, weight);
    }

    public void generateModel() {
        model = pilot.match(this);
    }

    public ArrangePilot getArrangePilot() {
        return arrangePilot;
    }

    public Context setArrangePilot(ArrangePilot arrangePilot) {
        this.arrangePilot = arrangePilot;
        return this;
    }
}
